package com.example.enterprisemanager.mvvm.main;

import com.example.enterprisemanager.base.BaseModel;
import com.example.enterprisemanager.mvvm.ben.User;

import cn.bmob.v3.BmobUser;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;

public class MainModel extends BaseModel {
    private Disposable mRegisterUserDisposable;

    public void isLogin(Consumer<User> success, Action fail) {
        try {
            if (BmobUser.isLogin()) {
                User user = BmobUser.getCurrentUser(User.class);
                success.accept(user);
            } else {
                fail.run();
            }
        } catch (Exception e) {

        }
    }

}
